﻿<div v-if="vmorder.cart.DiscountBox.Display" class="coupon-box">
    <template>
        <div class="accordion" role="tablist">
            <b-card no-body class="mb-1">
                <b-card-header header-tag="div" class="p-1" role="tab">
                    <b-button block v-b-toggle.accordion-discount class="coupon-button" variant="light">@Loc["ShoppingCart.DiscountCouponCode.Tooltip"]</b-button>
                </b-card-header>
                <b-collapse id="accordion-discount" accordion="discount-accordion" role="tabpanel">
                    <b-card-body>
                        <div class="coupon-code">
                            <div class="form-group">
                                <span class="col-form-label">@Loc["ShoppingCart.DiscountCouponCode"]</span>
                                <div class="input-group">
                                    <input type="text" id="discountcouponcode" name="discountcouponcode" class="form-control discount-coupon-code">
                                    <label for="discountcouponcode" class="sr-only">@Loc["ShoppingCart.Code.Button"]</label>
                                    <span class="input-group-append">
                                        <button type="button" name="applydiscountcouponcode" id="applydiscountcouponcode" @@click="vmorder.ApplyDiscountCode('@Url.RouteUrl("ApplyDiscountCoupon")')" class="btn btn-outline-secondary apply-discount-coupon-code-button">
                                            @Loc["ShoppingCart.DiscountCouponCode.Button"]
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>

                        <div v-if="vmorder.cart.DiscountBox.Message !== null && vmorder.cart.DiscountBox.IsApplied" class="alert alert-success message-success text-center">
                            {{vmorder.cart.DiscountBox.Message}}
                        </div>
                        <div v-if="vmorder.cart.DiscountBox.Message !== null && vmorder.cart.DiscountBox.IsApplied == false" class="alert alert-danger message-failure text-center">
                            {{vmorder.cart.DiscountBox.Message}}
                        </div>
                        <div v-if="vmorder.cart.DiscountBox.AppliedDiscountsWithCodes[0]" v-for="discount in vmorder.cart.DiscountBox.AppliedDiscountsWithCodes" class="alert alert-success text-center">
                            <span>@Loc["ShoppingCart.DiscountCouponCode.CurrentCode"].ToString().Replace("{0}", "{{discount.CouponCode}}")</span>
                            <b-link name="removediscount"
                                    title="@Loc["Common.Remove"]"
                                    class="mx-1"
                                    @@click="vmorder.RemoveDiscountId('@Url.RouteUrl("RemoveDiscountCoupon")?discountId=' + discount.Id)">
                                <b-icon icon="trash" variant="danger"></b-icon>
                            </b-link>
                        </div>
                    </b-card-body>
                </b-collapse>
            </b-card>
        </div>
    </template>
</div>